﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Antlr.Runtime.Tree;

namespace Ssc
{
    class SimSharpTreeAdaptor : Antlr.Runtime.Tree.CommonTreeAdaptor
    {
        public override object Create(Antlr.Runtime.IToken payload)
        {
            return new SimSharpTreeNode(payload);
        }

        public override object Create(int tokenType, Antlr.Runtime.IToken fromToken, string text)
        {
            return base.Create(tokenType, fromToken, text);
        }

        public override Antlr.Runtime.IToken CreateToken(int tokenType, string text)
        {
            return base.CreateToken(tokenType, text);
        }

        public override object DupNode(object t)
        {
            return base.DupNode(t);
        }

        //public override object ErrorNode(Antlr.Runtime.ITokenStream input, Antlr.Runtime.IToken start, Antlr.Runtime.IToken stop, Antlr.Runtime.RecognitionException e)
        //{
        //    SimSharpTreeNode t = new SimSharpTreeNode(start);
        //    t.startIndex = start.TokenIndex;
        //    t.stopIndex = stop.TokenIndex;
        //    return t;
        //}

        public override object ErrorNode(Antlr.Runtime.ITokenStream input, Antlr.Runtime.IToken start, Antlr.Runtime.IToken stop, Antlr.Runtime.RecognitionException e)
        {
            //Console.WriteLine(e.Message + "\n" + e.StackTrace);
            return new SimSharpErrorNode(input, start, stop, e);
        }
    }
}
